<template>
	<view>
		<top-navigation bgColor="#ffffff">
			<template #left-slot>
				绑定支付宝
			</template>
		</top-navigation>
		<view class="box">
			<view class="box-top">
				<input placeholder="请输入支付宝账号" v-model="ext2" maxlength="11" type="number" />
			</view>
			<view class="empty"></view>
			<view class="box-top">
				<input placeholder="请输入支付宝账号姓名" v-model="ext3" maxlength="10" />
			</view>
		</view>
		<view class="enter" @tap="save">保存</view>
	</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				ext2: '', //支付宝账号
				ext3: '', //支付宝账号姓名
				lock: false, //防止多次提交
			};
		},
		onLoad(e) {

		},
		methods: {
			save() {
				if (this.lock) return
				//数据验证
				if (this.$check.checkPhoneNumber(this.ext2, '支付宝账号', true)) return;
				if (this.$check.checkRealName(this.ext3, '支付宝账号姓名', true)) return;
				this.lock = true
				let params = {
					id: uni.getStorageSync('staffinfo'),
					ext2: this.ext2,
					ext3: this.ext3
				}
				this.$request('/applet/staff/bindAliAccount', params).then(res => {
					if (res.success) {
						this.$toast('绑定成功').then(() => {
							uni.navigateBack({})
						})
					} else this.$toast(res.msg)
					this.lock = false
				})
			}
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #f7f6fb;
	}

	.box {
		width: 690rpx;
		height: auto;
		background-color: white;
		border-radius: 20rpx;
		margin: 30rpx auto;
		box-shadow: 0rpx 2rpx 18rpx 0rpx rgba(0, 0, 0, 0.06);

		.box-top {
			width: 100%;
			height: 110rpx;
			display: flex;
			align-items: center;
			justify-content: space-between;

			input {
				margin-left: 36rpx;
			}
		}
	}

	.empty {
		width: 630rpx;
		height: 2rpx;
		background-color: #eeedf0;
		margin: 0 auto;
	}

	.enter {
		width: 690rpx;
		height: 96rpx;
		background-color: #55B5FF;
		border-radius: 50rpx;
		text-align: center;
		line-height: 96rpx;
		color: #FFFFFF;
		font-size: 36rpx;
		margin: 152rpx auto;
	}
</style>
